package cn.sofwin.day0120.homework.menu;

import java.util.Scanner;

public class Menu {
    int choose;
    Scanner sc = new Scanner(System.in);

    /**
     * 显示登录菜单
     */
  public void showLonginMenu(){
      boolean tf = true;
      do {
          System.out.println("欢迎使用我行我素购物管理系统");
          System.out.println("********************");
          System.out.println("\t1.登录系统");
          System.out.println("\t2.退出");
          System.out.print("请选择，输入数字：");
          this.choose = sc.nextInt();
          switch (this.choose) {
              case 1:
                  this.showMainMenu();
                  break;
              case 2:
                  System.out.println("谢谢使用");
                  tf = false;
                  break;
              default:
                  System.out.println("输入错误");

          }
      }while (tf);




  }

    /**
     * 显示主菜单
     */
  public void showMainMenu(){

      boolean tf = false;
      do {
          System.out.println("我行我素购物管理系统主菜单");
          System.out.println("********************");
          System.out.println("\t1.客户信息管理");
          System.out.println("\t2.真情回馈");
          System.out.print("请选择，输入数字或按0返回上一级菜单：");
          this.choose = sc.nextInt();
          switch (this.choose) {
              case 0:
                  showLonginMenu();
                  break;
              case 1:
                  showCustMenu();
                  break;
              case 2:
                  showSendGMenu();
                  break;
              default:
                  System.out.println("输入错误");
                  tf = true;
                  break;

          }
      }while(tf);



  }

    /**
     * 显示客户信息管理菜单
     */
  public void showCustMenu(){

      boolean tf = false;
      do {
          System.out.println("我行我素购物管理系统>客户信息管理");
          System.out.println("********************");
          System.out.println("\t1.查看客户信息");
          System.out.println("\t2.删除客户信息");
          System.out.print("请选择，输入数字或按0返回上一级菜单：");
          this.choose = sc.nextInt();
          switch (this.choose) {
              case 0:
                  showMainMenu();
                  break;
              case 1:
                  System.out.println("执行查看客户信息");
                  break;
              case 2:
                  System.out.println("执行删除客户信息");
                  break;
              default:
                  System.out.println("输入错误");
                  tf = true;
                  break;

          }
      }while(tf);



  }

    /**
     * 显示真情回馈菜单
     */
  public void showSendGMenu(){
      boolean tf = false;
      do {
          System.out.println("我行我素购物管理系统>真情回馈");
          System.out.println("\t1.幸运大放送");
          System.out.println("\t2.幸运抽奖");
          System.out.println("\t3.生日问候");
          System.out.print("请选择，输入数字或按0返回上一级菜单：");
          this.choose = sc.nextInt();
          switch (this.choose) {
              case 0:
                  showMainMenu();
                  break;
              case 1:
                  System.out.println("执行幸运大放送");
                  break;
              case 2:
                  System.out.println("执行幸运抽奖");
                  break;
              case 3:
                  System.out.println("执行生日问候");
                  break;
              default:
                  System.out.println("输入错误");
                  tf = true;
                  break;

          }
      }while(tf);


  }
}
